#ifndef CIRCLECREATEACTION_H
#define CIRCLECREATEACTION_H

#include "Common/Algebra/Vec2.h"
#include "EditorCore/IProvider.h"
#include "EditorCore/Actions/Action.h"
#include "Entities/PolygonEntity.h"
#include "Entities/VertexEntity.h"

class VertexCreateAction: public editor_core::Action, public editor_core::IProvider<VertexEntity*>
{
public:
	VertexCreateAction( const cmn::Vec2& position, editor_core::IProvider<PolygonEntity*>* parentPolygonProvider );
	virtual ~VertexCreateAction();

	virtual inline editor_core::ActionType GetType() const { return editor_core::ActionType::Undoable; }

	virtual inline VertexEntity* GetEntity() { return m_vertexEntity; }

protected:
	virtual bool Commit();
	virtual void Recommit();
	virtual void Rollback();

private:
	cmn::Vec2 m_position;

	editor_core::IProvider<PolygonEntity*>* m_parentPolygonProvider;
	VertexEntity* m_vertexEntity;
};

#endif
